'use strict';

let uniID = require('uni-id')
const createConfig = require('uni-config-center')
const uniIdConfig = createConfig({
	pluginId: 'uni-id'
}).config()

exports.main = async (event, context) => {
	//event为客户端上传的参数
	console.log('event : ', event)
	const token =
		'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiI2Mzg3NDE1OTkwYjI2ZDAwMDE3MzdkMWYiLCJyb2xlIjpbInh1ZXNoZW4iXSwicGVybWlzc2lvbiI6WyJYUyJdLCJpYXQiOjE2NzE4NDQzNzksImV4cCI6MTY3MTg4NzU3OX0.LAm3wgu5umyt4pcmrIK6agVHt-U1U9N9ZtMoFlS1_-k'
	//返回数据给客户端
	//UNI_WYQ:这里的uniID换成新的，保证多人访问不会冲突
	uniID = uniID.createInstance({
		context
	})
	let payload = await uniID.checkToken(token)

	return payload
};
